package ru.ipccenter.jshell.frontend.compiler;

import javax.tools.SimpleJavaFileObject;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.URI;


public class FileByteCode extends SimpleJavaFileObject {

  private final FileOutputStream outputStream;
  
  protected FileByteCode(String name, String dest, Kind kind) throws FileNotFoundException {
    
    super(URI.create("file:///" + dest + "/" + name + kind.extension), kind);
    outputStream = new FileOutputStream(dest + "/" + name + kind.extension);
  }
  
  @Override
  public OutputStream openOutputStream() {
    
      return this.outputStream;
  }
}
